package com.dream.model.stock;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Type;

import com.dream.model.base.AppUserModelBase;

@Entity
@Table(name="t_mst_express")
public class StockExpress extends AppUserModelBase implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1975445632667183764L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id ;
	
	@Column(name="express_type")
	private Long expressType;
	
	@Column(name="express_no")
	private String expressNo;
	
	@Column(name="from_name")
	private String fromName;
	
	@Column(name="from_address")
	private String fromAddress;
	
	@Column(name="from_user")
	private String fromUser;
	
	@Column(name="from_contact")
	private String fromContact;
	
	@Column(name="to_name")
	private String toName;
	
	@Column(name="to_address")
	private String toAddress;
	
	@Column(name="to_user")
	private String toUser;
	
	@Column(name="to_contact")
	private String toContact;
	
	@Column(name="to_zip")
	private String toZip;
	
	@Column(name="post_time")
	@Temporal( TemporalType.TIMESTAMP)
	private Date postTime;
	
	@Column(name="rcv_time")
	@Temporal( TemporalType.TIMESTAMP)
	private Date receiveTime;
	
	@Column(name="num")
	private Integer number;
	
	@Column(name="cost")
	private Float cost;
	
	@Column(name="weight")
	private Float weight;
	
	@Column(name="size")
	private String size;
	
	@Column(name="comments")
	private String comments;
	
	@Column(name="status")
	@Enumerated(EnumType.STRING)
	private ExpressStatus status;
	
	@Column(name="deleted")
	@Type(type = "org.hibernate.type.NumericBooleanType")
	private boolean deleted = false;
	
	
	public static enum ExpressStatus{post,received}


	public Long getId() {
		return id;
	}


	public void setId(Long id) {
		this.id = id;
	}


	public Long getExpressType() {
		return expressType;
	}


	public void setExpressType(Long expressType) {
		this.expressType = expressType;
	}


	public String getExpressNo() {
		return expressNo;
	}


	public void setExpressNo(String expressNo) {
		this.expressNo = expressNo;
	}


	public String getFromName() {
		return fromName;
	}


	public void setFromName(String fromName) {
		this.fromName = fromName;
	}


	public String getFromAddress() {
		return fromAddress;
	}


	public void setFromAddress(String fromAddress) {
		this.fromAddress = fromAddress;
	}


	public String getFromUser() {
		return fromUser;
	}


	public void setFromUser(String fromUser) {
		this.fromUser = fromUser;
	}


	public String getFromContact() {
		return fromContact;
	}


	public void setFromContact(String fromContact) {
		this.fromContact = fromContact;
	}


	public String getToName() {
		return toName;
	}


	public void setToName(String toName) {
		this.toName = toName;
	}


	public String getToAddress() {
		return toAddress;
	}


	public void setToAddress(String toAddress) {
		this.toAddress = toAddress;
	}


	public String getToUser() {
		return toUser;
	}


	public void setToUser(String toUser) {
		this.toUser = toUser;
	}


	public String getToContact() {
		return toContact;
	}


	public void setToContact(String toContact) {
		this.toContact = toContact;
	}


	public String getToZip() {
		return toZip;
	}


	public void setToZip(String toZip) {
		this.toZip = toZip;
	}


	public Date getPostTime() {
		return postTime;
	}


	public void setPostTime(Date postTime) {
		this.postTime = postTime;
	}


	public Date getReceiveTime() {
		return receiveTime;
	}


	public void setReceiveTime(Date receiveTime) {
		this.receiveTime = receiveTime;
	}


	public Integer getNumber() {
		return number;
	}


	public void setNumber(Integer number) {
		this.number = number;
	}


	public Float getCost() {
		return cost;
	}


	public void setCost(Float cost) {
		this.cost = cost;
	}


	public Float getWeight() {
		return weight;
	}


	public void setWeight(Float weight) {
		this.weight = weight;
	}


	public String getSize() {
		return size;
	}


	public void setSize(String size) {
		this.size = size;
	}


	public String getComments() {
		return comments;
	}


	public void setComments(String comments) {
		this.comments = comments;
	}


	public ExpressStatus getStatus() {
		return status;
	}


	public void setStatus(ExpressStatus status) {
		this.status = status;
	}


	public boolean isDeleted() {
		return deleted;
	}


	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		StockExpress other = (StockExpress) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
}
